#ifndef CTABLECONFIG_H
#define CTABLECONFIG_H

#include "AbsTable.h"
#include <QMetaEnum>

#define SELECTE_ID "SelectedId"
struct StConfig{
    StConfig(QString strKey,QString strValue):
    key(strKey),value(strValue){}
    QString key;
    QString value;
};
class CTableConfig : public AbsTable
{
    Q_OBJECT
public:
    explicit CTableConfig(QObject *parent = nullptr);

    static CTableConfig* instance();

    enum Column{
        key = 0,
        value,
    };

    enum Key{
        IsTop,
        SelectedId,
        DefaultPort,
        TextCode,
        MaxLine,
        LongPress,
        Span,
        Language,
        Skin,
        CurrSkin,
        PrimiaryColor,
        Font,
        FontSize,
    };
    Q_ENUM(Key)

    bool createTable() override;

    bool updateValue(Key enmKey, QString strValue);
    QString queryValue(Key enmKey);


    bool addRow(StConfig st);
//    bool updateRow(StConfig &st);
    bool updateValue(QString strKey, QString strValue);

    bool deleteRow(QString strKey);
//    StConfig queryRow(QString strKey);
    QString queryValue(QString strKey);

//    QVector<StConfig> queryAll();
};

#endif // CTABLECONFIG_H
